//
//  BusinessActionView.m
//  NewPro
//
//  Created by 何荧红 on 2018/11/24.
//  Copyright © 2018 何荧红. All rights reserved.
//

#import "BusinessActionView.h"

@interface BusinessActionView ()
@property (nonatomic, strong) UIImageView *subimage;

@end

@implementation BusinessActionView
- (void)setSubimageurl:(NSString *)subimageurl{
    _subimageurl = subimageurl;
    if (_subimageurl.length > 0) {
        self.subimage.backgroundColor = [UIColor whiteColor];
        [self.subimage sd_setImageWithURL:[NSURL URLWithString:_subimageurl] placeholderImage:[UIImage imageNamed:@""]];
    }
//    else{
//        self.subimage.backgroundColor = [UIColor clearColor];
//        self.subimage.image = [UIImage imageNamed:@""];
//    }
}
- (instancetype)init{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
        [self CleanWithView];
    }
    return self;
}
- (void)CleanWithView{
    UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    [button addTarget:self action:@selector(removeView) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:button];
    UIView *subb = [[UIView alloc]init];
    subb.layer.masksToBounds = YES;
    subb.layer.cornerRadius = 10;
    subb.backgroundColor = [UIColor whiteColor];
    [self addSubview:subb];
    [subb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(125);
        make.centerX.equalTo(self.mas_centerX);
        make.width.mas_equalTo(270);
        make.height.mas_equalTo(325);
    }];
//    UILabel *subbtitle = [[UILabel alloc]init];
//    subbtitle.font = [UIFont fontWithName:@"PingFang-SC-Heavy" size:15];
//    subbtitle.textColor = [UIColor colorWithHexString:@"000000"];
//    subbtitle.text = @"划拨规则";
//    [subb addSubview:subbtitle];
//    [subbtitle mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(subb.mas_centerX);
//        make.top.equalTo(subb.mas_top).offset(23);
//    }];
//    for (NSInteger i = 0; i < 4; i++) {
//        UILabel *subtitle1 = [[UILabel alloc]init];
//        subtitle1.numberOfLines = 2;
//        subtitle1.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15];
//        subtitle1.textColor = [UIColor colorWithHexString:@"666666"];
//        if (i == 0) {
//            subtitle1.text = @"状态为“已开通”、“审核中”的终端不可划拨；";
//        }else if (i == 1){
//            subtitle1.text = @"已划拨终端开通后所产生的收益归属于开通该终端的注册账号；";
//        }else if (i == 2){
//            subtitle1.text = @"开通激活返现归属于采购该终端的注册账号。";
//        }else if (i == 3){
//            subtitle1.text = @"定向划拨仅限本团队内部由上级划拨至该团队任意下级。";
//        }
//        [subb addSubview:subtitle1];
//        [subtitle1 mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.equalTo(subb.mas_left).offset(26);
//            make.right.equalTo(subb.mas_right).offset(-26);
//            make.top.equalTo(subbtitle.mas_bottom).offset(21 + 52 * i);
//        }];
//        UIView *round = [[UIView alloc]init];
//        round.backgroundColor = [UIColor colorWithHexString:@"666666"];
//        round.layer.masksToBounds = YES;
//        round.layer.cornerRadius = 2;
//        [subb addSubview:round];
//        [round mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.equalTo(subb.mas_left).offset(17);
//            make.centerY.equalTo(subtitle1.mas_centerY).offset(-10);
//            make.width.mas_equalTo(4);
//            make.height.mas_equalTo(4);
//        }];
//    }
    self.subimage = [[UIImageView alloc]init];
    _subimage.backgroundColor = [UIColor clearColor];
    [subb addSubview:_subimage];
    [_subimage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
}
- (void)removeView{
    [self removeFromSuperview];
}

@end
